/*
 * @Author: AHANG
 * @Date: 2022-06-16 11:24:11
 * @LastEditors: AHANG
 * @LastEditTime: 2022-07-23 10:50:14
 * @Description:    axios 接口同一化
 */

//引入模块
import requests from "./request";
//ip地址
// export const getIP = () => {
//   return requests({
//     url: "https://api.ipify.org/?format=json",
//     method: "get",
//   });
// };
// /api/user/getCaptcha  get 无参数
//登录
// export const login = (obj) => {
//   return requests({
//     url: "/user/login",
//     method: "post",
//     data: {
//       user: obj.user,
//       pass: obj.pass,
//     },
//   });
// };

//查
export const searchUser = () => {
  return requests({
    url: "/user/searchUser",
    method: "get",
  });
};

// 删
export const deleteUser = (id) => {
  return requests({
    url: "/user/deleteUser",
    method: "delete",
    data: {
      id: id,
    },
  });
};

// 改;
export const updateUser = (obj) => {
  return requests({
    url: "/user/updateUser",
    method: "post",
    data: {
      name: obj.name,
      sex: obj.sex,
      mz: obj.mz,
      id: obj.id,
      phone: obj.phone,
      qs: obj.qs,
      address: obj.address,
    },
  });
};

//增
export const addUser = (obj) => {
  return requests({
    url: "/user/addUser",
    method: "post",
    data: {
      name: obj.name,
      sex: obj.sex,
      mz: obj.mz,
      id: obj.id,
      phone: obj.phone,
      qs: obj.qs,
      address: obj.address,
    },
  });
};
